#include <iostream>
#include <stack>
#include <map>

int main() {
    std::map<char, int> slovar = {{'(', 1}, {'[', 2}, {'{', 3}, {'<', 4}, {')', 1}, {']', 2}, {'}', 3}, {'>', 4}};
    std::string OTK = "([{<";
    std::string stroka;
    std::cin >> stroka;
    std::stack<int> stek;
    bool flag = true;
    for (size_t i = 0; i < stroka.length(); ++i) {
        if (OTK.find(stroka[i]) != std::string::npos) {
            stek.push(slovar[stroka[i]]);
        } else if (slovar.find(stroka[i]) != slovar.end()) {
            if (slovar[stroka[i]] == stek.top()) {
                stek.pop();
            } else {
                flag = false;
                break;
            }
        }
    }
    if (stek.empty() && flag) {
        std::cout << "TRUE" << std::endl;
    } else {
        std::cout << "FAIL" << std::endl;
    }
    return 0;
}